import java.util.Scanner;

public class TestMain {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String arr = scan.nextLine();
        int[] hs = new int[26];
        for(int i = 0; i < arr.length(); i++) {
            hs[arr.charAt(i) - 'a']++;
        }
        int count = 0;
        char tmp = 'a';
        for(int i = 0; i < hs.length; i++) {
            if(hs[i] > count) {
                count = hs[i];
                tmp = (char)('a' + i);
            }
        }
        System.out.println(tmp);
        System.out.println(count);
        scan.close();
    }
}
